﻿@model blacksoft.Models.ART_Venta
@using blacksoft.Helpers

@{
    ViewBag.Title = "Payment";
    Layout = "~/Views/Shared/_LayoutVentas.cshtml";
}

@*Depuración*@
@if (null != TempData["alertMessage"])
{
    <script type="text/javascript">
        alert("@TempData["alertMessage"]");
    </script>
}

<div class="block big">
    <div class="titlebar">
        <h3>Nueva Venta</h3>
    </div>
    <div class="block_cont">

        <h4>Datos del Pagador:</h4>
        <hr />

        @using (Html.BeginForm("Payment", "Venta", FormMethod.Get))
        {
            <div class="form">
                @Html.LabelFor(model => model.ClienteJ.RUC)
                @Html.TextBox("CJ_RUC", null, new { @class = "text-box single-line" })
                @Html.ValidationMessage("ErrorEmpresaNull")
                @Html.LabelFor(model => model.ClienteJ.RazonSocial)
                @Html.TextBox("CJ_RazonSocial", null, new { @class = "text-box single-line", @readonly = "readonly", @disabled = "disabled", @style = "background:#cccccc;" })
                @Html.LabelFor(model => model.ClienteJ.Direccion)
                @Html.TextBox("CJ_Direccion", null, new { @class = "text-box single-line", @readonly = "readonly", @disabled = "disabled", @style = "background:#cccccc;" })
                @Html.LabelFor(model => model.ClienteJ.Telefono)
                @Html.TextBox("CJ_Telefono", null, new { @class = "text-box single-line", @readonly = "readonly", @disabled = "disabled", @style = "background:#cccccc;" })
                @Html.LabelFor(model => model.ClienteJ.Email)
                @Html.TextBox("CJ_Email", null, new { @class = "text-box single-line", @readonly = "readonly", @disabled = "disabled", @style = "background:#cccccc;" })
            </div>
            <input type="submit" value="Buscar" class="btn btn-default" style="margin-top: 10px;" />

            <h4>Medio de Pago: &nbsp;&nbsp; (Tipo de Cambio: <a style="display:inline-block">@Html.Label("TipoCambio", (string)ViewBag.TipoCambio, new { @class = "tipoCambio" })</a>)</h4>
            <hr />

            <div class="form">
                <div class="form-row">
                    <table>
                        <tr>
                            <td>
                                @Html.CheckBox("chbxNotaCred", true)
                            </td>
                            <td>
                                @Html.LabelForRequired(model => model.IDNotaCredito)
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                @Html.TextBox("IDNota", null, new { @class = "text-box single-line" })
                                @Html.ValidationMessage("ErrorNotaCredNull")
                                @*@Html.ValidationMessageFor(model => model.IDNotaCredito)*@
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="form-row">
                    @Html.LabelForRequired(model => model.MontoNotaCredito)
                    @Html.TextBox("MontoNota", null, new { @class = "operando text-box single-line", @readonly = "readonly", @style = "background:#cccccc;" })
                    @Html.ValidationMessageFor(model => model.MontoNotaCredito)
                </div>
            </div>
            <input type="submit" value="Buscar" class="btn btn-default" style="margin-top: 10px;" />
        }

        @using (Html.BeginForm("Payment", "Venta", FormMethod.Post))
        {
            @Html.AntiForgeryToken()
            <div class="form">
                <div class="form-row">
                    @Html.LabelForRequired(model => model.MedioPago)
                    @Html.DropDownList("MedioPago", null, "Elegir", new { @class = "select" })
                    @Html.ValidationMessageFor(model => model.MedioPago)
                </div>
                <div class="form-row">
                    @Html.LabelForRequired(model => model.MontoSoles)
                    @Html.TextBoxFor(model => model.MontoSoles, new { @class = "operando text-box single-line" })
                    @Html.ValidationMessageFor(model => model.MontoSoles)
                </div>
                <div class="form-row">
                    @Html.LabelForRequired(model => model.MontoDolares)
                    @Html.TextBoxFor(model => model.MontoDolares, new { @class = "operando text-box single-line" })
                    @Html.ValidationMessageFor(model => model.MontoDolares)
                </div>
                <div class="form-row">
                    @Html.LabelForRequired(model => model.MontoTarjeta)
                    @Html.TextBoxFor(model => model.MontoTarjeta, new { @class = "operando text-box single-line" })
                    @Html.ValidationMessageFor(model => model.MontoTarjeta)
                </div>
                <div class="form-row">
                    @Html.LabelFor(model => model.Total)
                    @Html.TextBoxFor(model => model.Total, new { @class = "text-box single-line", @readonly = "readonly", @style = "background:#cccccc;" })
                    @Html.ValidationMessageFor(model => model.Total)
                </div>
                <div class="form-row">
                    @Html.LabelFor(model => model.MontoDescuento)
                    @Html.TextBoxFor(model => model.MontoDescuento, new { @class = "text-box single-line", @readonly = "readonly", @style = "background:#cccccc;" })
                    @Html.ValidationMessageFor(model => model.MontoDescuento)
                </div>
                <div class="form-row">
                    @Html.LabelFor(model => model.Vuelto)
                    @Html.TextBoxFor(model => model.Vuelto, new { @class = "text-box single-line", @readonly = "readonly", @style = "background:#cccccc;" })
                    @Html.ValidationMessageFor(model => model.Vuelto)
                </div>
            </div>

            <div class="form-group">
                <input type="submit" value="Generar Venta" class="btn btn-default" style="margin-top: 10px;" onclick="return confirm('¿Desea guardar esta venta?')" />
                <br />
                @Html.ActionLink("Regresar", "ReserveConfirmation")
            </div>
        }
    </div>
</div>


<script type="text/javascript" src="/data/js/mod_ventas.js"></script>
